package com.mac.sentinel.service;

import com.mac.sentinel.bean.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@FeignClient(value = "sentinel-a", fallback = UserService.UserServiceFallback.class)
public interface UserService
{

    @RequestMapping(value = "/user/findAll", method = RequestMethod.GET)
    public List<User> findAll();


    @Component
    public class UserServiceFallback implements UserService
    {

        @Override
        public List<User> findAll()
        {
            System.out.println("findAll网络请求发生异常，熔断");
            return null;
        }
    }

}
